home *** CD-ROM | disk | FTP | other *** search
/ SGI Performance Co-Pilot 1.3 / SGI Performance Co-Pilot 1.3.iso / dist / dist6.4 / pcp.idb / usr / sbin / nfsvis.z / nfsvis
Text File  |  1997-04-03  |  11KB  |  341 lines

  1. #!/bin/sh
  2. #  Copyright (c) 1994 Silicon Graphics, Inc.
  3. #  ALL RIGHTS RESERVED.
  4. #  U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
  5. #  Use, duplication or disclosure by the Government is subject to
  6. #  restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
  7. #  (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
  8. #  at DFARS 252.227-7013 and/or similar or successor clauses in the FAR,
  9. #  or the DOD or NASA FAR Supplement.  Contractor/manufacturer is Silicon
  10. #  Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
  11. #  THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
  12. #  SILICON GRAPHICS, INC.  ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
  13. #  DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
  14. #  PERMISSION OF SILICON GRAPHICS, INC.
  15. # /
  16.  
  17. #
  18. # $Id: nfsvis.sh,v 2.11 1997/03/21 08:52:13 kenmcd Exp $
  19. #
  20.  
  21. tmp=/tmp/$$
  22. trap "rm -f $tmp.*; exit" 0 1 2 3  15
  23. rm -f $tmp.*
  24.  
  25. . /usr/pcp/lib/pmview-args
  26.  
  27. _usage()
  28. {
  29.     echo 'Usage: nfsvis [options]
  30.  
  31. options:
  32.   -c   version    Monitor NFS version (integer) client metrics [default 2]
  33.   -m   maxrate    maximum request rate expected (integer) [default 120]
  34.   -s   version    Monitor NFS version (integer) server metrics [default 2]
  35.   -v   version    generate scene for different versions of pmview [default 2]
  36.   -V              verbose/diagnostic output  
  37.  
  38. pmview(1) options:'
  39.     _pmview_usage
  40.     echo
  41.     echo 'Default title is: NFS Version 2 Request Traffic for Host'
  42. }
  43.  
  44. max=120
  45. client=2
  46. server=2
  47. type=total
  48. Type=Total
  49. verbose=false
  50. version="2"
  51.  
  52. _pmview_args "$@"
  53.  
  54. if [ -n "$otherArgs" ]
  55. then
  56.     while getopts "?c:m:s:v:V" c $otherArgs
  57.     do
  58.     case $c
  59.     in
  60.         c)
  61.         client=$OPTARG
  62.         if [ "$client" != 2 -a "$client" != 3 ]
  63.         then
  64.             echo "$prog: only NFS 2 and NFS 3 client metrics supported"
  65.             _usage
  66.             exit 1
  67.         fi
  68.         ;;
  69.         m)
  70.         max=$OPTARG
  71.         # and now the obscure +ve integer checking bit
  72.         # ...note the creative use of unary - to prevent leading signs
  73.         if [ "X-$max" != "X`expr 0 + -$max 2>/dev/null`" ]
  74.         then
  75.             echo "$prog: -m must have a positive integral argument"
  76.             _usage
  77.             exit 1
  78.         fi
  79.         ;;
  80.         s)
  81.         server=$OPTARG
  82.         if [ "$server" != 2 -a "$server" != 3 ]
  83.         then
  84.             echo "$prog: only NFS 2 and NFS 3 server metrics supported"
  85.             _usage
  86.             exit 1
  87.         fi
  88.         ;;
  89.         v)
  90.         version=$OPTARG
  91.         if [ $version != "1" -a $version != "2" ]
  92.         then
  93.             echo "$prog: only versions 1 and 2 supported"
  94.             _usage
  95.             exit 1
  96.         fi
  97.         ;;
  98.         V)
  99.         verbose=true
  100.         ;;
  101.         ?)
  102.         _usage
  103.         exit 1
  104.         ;;
  105.     esac
  106.     done
  107.     set - $otherArgs
  108.     shift `expr $OPTIND - 1`
  109.     if [ $# -gt 0 ]
  110.     then
  111.     _usage
  112.     exit 1
  113.     fi
  114. fi
  115.  
  116. if [ "X$arch" != X ]
  117. then
  118.     host=`pmdumplog -l $arch | awk '/^Performance/ {print $5}' | sed -e 's/,//g'`
  119.     [ "X$host" = X ] && host="unknown host"
  120.     host="$host (Archive $arch)"
  121.     source="-a $arch"
  122. elif [ "X$host" = X ]
  123. then
  124.     host=`/usr/bsd/hostname`
  125.     source=
  126. else
  127.     source="-h $host"
  128. fi
  129.  
  130. if [ "$client" = "3" ]
  131. then
  132.     if pminfo -f $source irix.nfs3.client 2>&1 | grep Unknown > /dev/null 2>&1
  133.     then
  134.         echo "$prog: NFS Version 3 client metrics not supported on Host $host"
  135.     exit 1
  136.     fi
  137. fi 
  138.  
  139. if [ "$server" = "3" ]
  140. then
  141.     if pminfo -f $source irix.nfs3.server 2>&1 | grep Unknown > /dev/null 2>&1
  142.     then
  143.         echo "$prog: NFS Version 3 server metrics not supported on Host $host"
  144.     exit 1
  145.     fi
  146. fi 
  147.  
  148. if [ -z "$titleArg" ]
  149. then
  150.     titleArg="NFS Client V$client & Server V$server Request Traffic for Host $host"
  151. fi
  152.  
  153. if [ $version = "2" ]
  154. then
  155.  
  156. #
  157. # pmview 2.0
  158. #
  159.  
  160.     cat << End-of-File > $tmp.config
  161. pmview Version 2.0
  162. #
  163. # nfsvis
  164. #
  165. _scale 1.05
  166. _colorlist colors (red1 green1 blue1)
  167. _grid hide (
  168.     _label 2 0 (
  169.         _direction down
  170.         _size large
  171.         _text "Client"
  172.     )
  173.     _labeledbar 0 0 east (
  174.         _metrics (
  175. End-of-File
  176.  
  177.     if [ "$client" = "2" ]
  178.     then
  179.     cat << End-of-File >> $tmp.config
  180.             irix.nfs.client.reqs[create,remove,rename,link,symlink,mkdir,rmdir]    $max
  181.             irix.nfs.client.reqs[getattr,setattr,lookup,readdir,fsstat,root]    $max
  182.             irix.nfs.client.reqs[readlink,read,write,wrcache]            $max
  183. End-of-File
  184.     else
  185.     cat << End-of-File >> $tmp.config
  186.             irix.nfs3.client.reqs[create,remove,rename,link,symlink,mkdir,rmdir,mknod]            $max
  187.             irix.nfs3.client.reqs[getattr,setattr,lookup,readdir,fsstat,access,readdir+,fsinfo,pathconf]    $max
  188.             irix.nfs3.client.reqs[readlink,read,write,commit]                        $max
  189. End-of-File
  190.     fi
  191.     cat << End-of-File >> $tmp.config
  192.         )
  193.         _metriclabels ( "dir" "attr" "data" )
  194.         _colorlist colors
  195.     )
  196.     _label 2 2 (
  197.         _direction down
  198.         _size large
  199.         _text "Server"
  200.     )
  201.     _labeledbar 0 2 east (
  202.         _metrics (
  203. End-of-File
  204.     if [ "$server" = "2" ]
  205.     then
  206.     cat << End-of-File >> $tmp.config
  207.             irix.nfs.server.reqs[create,remove,rename,link,symlink,mkdir,rmdir]    $max
  208.             irix.nfs.server.reqs[getattr,setattr,lookup,readdir,fsstat,root]    $max
  209.             irix.nfs.server.reqs[readlink,read,write,wrcache]            $max
  210. End-of-File
  211.     else
  212.     cat << End-of-File >> $tmp.config
  213.             irix.nfs3.server.reqs[create,remove,rename,link,symlink,mkdir,rmdir,mknod]            $max
  214.             irix.nfs3.server.reqs[getattr,setattr,lookup,readdir,fsstat,access,readdir+,fsinfo,pathconf]    $max
  215.             irix.nfs3.server.reqs[readlink,read,write,commit]                        $max
  216. End-of-File
  217.     fi
  218.     cat << End-of-File >> $tmp.config
  219.         )
  220.         _metriclabels ( "dir" "attr" "data" )
  221.         _colorlist colors
  222.     )
  223. )
  224. End-of-File
  225.  
  226. else
  227.  
  228. #
  229. # pmview 1.0
  230. #
  231.     cat <<End-of-File > $tmp.config
  232. # pmview 1.0
  233. #
  234. # nfsvis
  235. #
  236. End-of-File
  237.  
  238.     if [ "$server" = "2" ]
  239.     then
  240.     cat <<End-of-File >> $tmp.config
  241. 5 0  0.0 1.0 0.0   $max   srvr-dir    irix.nfs.server.reqs create
  242. 5 1  0.0 0.0 1.0   $max   -           irix.nfs.server.reqs remove
  243. 5 2  1.0 0.0 0.0   $max   -           irix.nfs.server.reqs rename
  244. 5 3  0.0 1.0 1.0   $max   -           irix.nfs.server.reqs link
  245. 5 4  1.0 1.0 0.0   $max   -           irix.nfs.server.reqs symlink
  246. 5 5  1.0 0.0 1.0   $max   -           irix.nfs.server.reqs mkdir
  247. 5 6  0.0 1.0 0.5   $max   -           irix.nfs.server.reqs rmdir
  248. 6 0  0.5 0.0 1.0   $max   srvr-attr   irix.nfs.server.reqs getattr
  249. 6 1  1.0 0.5 0.0   $max   -           irix.nfs.server.reqs setattr
  250. 6 2  1.0 0.0 0.5   $max   -           irix.nfs.server.reqs lookup
  251. 6 3  0.5 1.0 0.0   $max   -           irix.nfs.server.reqs readdir
  252. 6 4  0.0 1.0 0.0   $max   -           irix.nfs.server.reqs fsstat
  253. 6 5  0.0 0.5 1.0   $max   -           irix.nfs.server.reqs root
  254. 7 0  0.0 0.0 1.0   $max   srvr-data   irix.nfs.server.reqs readlink
  255. 7 1  1.0 0.0 0.0   $max   -           irix.nfs.server.reqs read
  256. 7 2  0.0 1.0 1.0   $max   -           irix.nfs.server.reqs write
  257. 7 3  1.0 1.0 0.0   $max   -           irix.nfs.server.reqs wrcache
  258. End-of-File
  259.     else
  260.     cat <<End-of-File >> $tmp.config
  261. 5 0  0.0 1.0 0.0   $max   srvr-dir    irix.nfs3.server.reqs create
  262. 5 1  0.0 0.0 1.0   $max   -           irix.nfs3.server.reqs remove
  263. 5 2  1.0 0.0 0.0   $max   -           irix.nfs3.server.reqs rename
  264. 5 3  0.0 1.0 1.0   $max   -           irix.nfs3.server.reqs link
  265. 5 4  1.0 1.0 0.0   $max   -           irix.nfs3.server.reqs symlink
  266. 5 5  1.0 0.0 1.0   $max   -           irix.nfs3.server.reqs mkdir
  267. 5 6  0.0 1.0 0.5   $max   -           irix.nfs3.server.reqs rmdir
  268. 5 7  0.5 0.0 1.0   $max   -           irix.nfs3.server.reqs mknod
  269. 6 0  0.5 0.0 1.0   $max   srvr-attr   irix.nfs3.server.reqs getattr
  270. 6 1  1.0 0.5 0.0   $max   -           irix.nfs3.server.reqs setattr
  271. 6 2  1.0 0.0 0.5   $max   -           irix.nfs3.server.reqs lookup
  272. 6 3  0.5 1.0 0.0   $max   -           irix.nfs3.server.reqs readdir
  273. 6 4  0.0 1.0 0.0   $max   -           irix.nfs3.server.reqs fsstat
  274. 6 5  0.0 0.0 1.0   $max   -           irix.nfs3.server.reqs access
  275. 6 6  1.0 0.0 0.0   $max   -           irix.nfs3.server.reqs readdir+
  276. 6 7  0.0 1.0 1.0   $max   -           irix.nfs3.server.reqs fsinfo
  277. 6 8  1.0 1.0 0.0   $max   -           irix.nfs3.server.reqs pathconf
  278. 7 0  0.0 0.0 1.0   $max   srvr-data   irix.nfs3.server.reqs readlink
  279. 7 1  1.0 0.0 0.0   $max   -           irix.nfs3.server.reqs read
  280. 7 2  0.0 1.0 1.0   $max   -           irix.nfs3.server.reqs write
  281. 7 3  1.0 0.5 0.0   $max   -           irix.nfs3.server.reqs commit
  282. End-of-File
  283.     fi
  284.  
  285.     if [ "$client" = "2" ]
  286.     then
  287.     cat <<End-of-File >> $tmp.config
  288. 1 0  0.0 1.0 0.0   $max   clnt-dir    irix.nfs.client.reqs create
  289. 1 1  0.0 0.0 1.0   $max   -           irix.nfs.client.reqs remove
  290. 1 2  1.0 0.0 0.0   $max   -           irix.nfs.client.reqs rename
  291. 1 3  0.0 1.0 1.0   $max   -           irix.nfs.client.reqs link
  292. 1 4  1.0 1.0 0.0   $max   -           irix.nfs.client.reqs symlink
  293. 1 5  1.0 0.0 1.0   $max   -           irix.nfs.client.reqs mkdir
  294. 1 6  0.0 1.0 0.5   $max   -           irix.nfs.client.reqs rmdir
  295. 2 0  0.5 0.0 1.0   $max   clnt-attr   irix.nfs.client.reqs getattr
  296. 2 1  1.0 0.5 0.0   $max   -           irix.nfs.client.reqs setattr
  297. 2 2  1.0 0.0 0.5   $max   -           irix.nfs.client.reqs lookup
  298. 2 3  0.5 1.0 0.0   $max   -           irix.nfs.client.reqs readdir
  299. 2 4  0.0 1.0 0.0   $max   -           irix.nfs.client.reqs fsstat
  300. 2 5  0.0 0.5 1.0   $max   -           irix.nfs.client.reqs root
  301. 3 0  0.0 0.0 1.0   $max   clnt-data   irix.nfs.client.reqs readlink
  302. 3 1  1.0 0.0 0.0   $max   -           irix.nfs.client.reqs read
  303. 3 2  0.0 1.0 1.0   $max   -           irix.nfs.client.reqs write
  304. 3 3  1.0 1.0 0.0   $max   -           irix.nfs.client.reqs wrcache
  305. End-of-File
  306.     else
  307.     cat <<End-of-File >> $tmp.config
  308. 1 0  0.0 1.0 0.0   $max   clnt-dir    irix.nfs3.client.reqs create
  309. 1 1  0.0 0.0 1.0   $max   -           irix.nfs3.client.reqs remove
  310. 1 2  1.0 0.0 0.0   $max   -           irix.nfs3.client.reqs rename
  311. 1 3  0.0 1.0 1.0   $max   -           irix.nfs3.client.reqs link
  312. 1 4  1.0 1.0 0.0   $max   -           irix.nfs3.client.reqs symlink
  313. 1 5  1.0 0.0 1.0   $max   -           irix.nfs3.client.reqs mkdir
  314. 1 6  0.0 1.0 0.5   $max   -           irix.nfs3.client.reqs rmdir
  315. 1 7  0.5 0.0 1.0   $max   -           irix.nfs3.client.reqs mknod
  316. 2 0  0.5 0.0 1.0   $max   clnt-attr   irix.nfs3.client.reqs getattr
  317. 2 1  1.0 0.5 0.0   $max   -           irix.nfs3.client.reqs setattr
  318. 2 2  1.0 0.0 0.5   $max   -           irix.nfs3.client.reqs lookup
  319. 2 3  0.5 1.0 0.0   $max   -           irix.nfs3.client.reqs readdir
  320. 2 4  0.0 1.0 0.0   $max   -           irix.nfs3.client.reqs fsstat
  321. 2 5  0.0 0.0 1.0   $max   -           irix.nfs3.client.reqs access
  322. 2 6  1.0 0.0 0.0   $max   -           irix.nfs3.client.reqs readdir+
  323. 2 7  0.0 1.0 1.0   $max   -           irix.nfs3.client.reqs fsinfo
  324. 2 8  1.0 1.0 0.0   $max   -           irix.nfs3.client.reqs pathconf
  325. 3 0  0.0 0.0 1.0   $max   clnt-data   irix.nfs3.client.reqs readlink
  326. 3 1  1.0 0.0 0.0   $max   -           irix.nfs3.client.reqs read
  327. 3 2  0.0 1.0 1.0   $max   -           irix.nfs3.client.reqs write
  328. 3 3  1.0 0.5 0.0   $max   -           irix.nfs3.client.reqs commit
  329. End-of-File
  330.     fi
  331. fi
  332.  
  333. $verbose && cat $tmp.config
  334.  
  335. eval /usr/sbin/pmview <$tmp.config $args -title "'$titleArg'" -xrm "'*iconName: nfsvis'"
  336.  
  337. exit
  338.